package com.hd.trans.utils

/**
 * 判官-判断类函数集
 */
object JudgeUtil {

    /**
     * 验证字符串是否为有效的Android十六进制颜色值
     * @param colorStr 待验证的字符串
     * @return 是否有效
     */
    fun isValidColor(colorStr: String?): Boolean {
        val pattern = "^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
        return colorStr != null && colorStr.matches(pattern.toRegex())
    }
}